//
//  Test100ViewController.swift
//  JKRegex
//
//  Created by 王冲 on 2018/1/30.
//  Copyright © 2018年 希爱欧科技有限公司. All rights reserved.
//

import UIKit

class Test100ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.view.backgroundColor = UIColor.white
        
        //原始字符串
        let str1 = "欢迎访问hangge.com.com.com"
        //替换后的字符串
        let str2 = str1.replacingOccurrences(of: "com", with: "COM")
        //打印结果
        print("原字符串：\(str1)")
        print("新字符串：\(str2)")
        
        //原始字符串
        let str3 = "欢迎访问hangge.com"
        //替换后的字符串
        let str4 = str1.pregReplace(pattern: "[a-zA-Z]", with: "_")
        //打印结果
        print("原字符串：\(str3)")
        print("新字符串：\(str4)")
        
    }
    
}

